<html>
<head><meta charset="utf-8"><title>rustdoc and async fn #63710 · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html">rustdoc and async fn #63710</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="176049578"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176049578" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176049578">(Sep 18 2019 at 21:46)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="116773">@csmoe</span> I <a href="https://github.com/rust-lang/rust/issues/63710#issuecomment-532879511" target="_blank" title="https://github.com/rust-lang/rust/issues/63710#issuecomment-532879511">left some mentoring instructions here</a> -- let me know if they make sense to you. I was basically just pointing out the bits of code that you'll want to copy so that you can thread this info through to rustdoc.</p>



<a name="176119524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176119524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176119524">(Sep 19 2019 at 17:02)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> while tring to invoke <code>is_async_fn</code> query <a href="https://github.com/rust-lang/rust/pull/64599/files#diff-6ad072c1ebc79b7620832915f2323d55R2406" target="_blank" title="https://github.com/rust-lang/rust/pull/64599/files#diff-6ad072c1ebc79b7620832915f2323d55R2406">here</a>, rustc ICEs: </p>
<div class="codehilite"><pre><span></span>`tcx.is_async_fn(DefId(0:3094 ~ alloc[8787]::borrow[0]::{{impl}}[1]::to_owned[0]))` unsupported by its crate
</pre></div>


<p>what does it mean?</p>



<a name="176119896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176119896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176119896">(Sep 19 2019 at 17:06)</a>:</h4>
<p>good question :)</p>



<a name="176119906"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176119906" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176119906">(Sep 19 2019 at 17:07)</a>:</h4>
<p>ah hmm</p>



<a name="176119920"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176119920" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176119920">(Sep 19 2019 at 17:07)</a>:</h4>
<p>I think it means maybe you forgot to register a provider</p>



<a name="176119932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176119932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176119932">(Sep 19 2019 at 17:07)</a>:</h4>
<p>is that your WIP PR? I can take a look</p>



<a name="176120277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176120277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176120277">(Sep 19 2019 at 17:10)</a>:</h4>
<p>hm, no I think that's more likely that it needs to be added to cstore</p>



<a name="176120287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176120287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176120287">(Sep 19 2019 at 17:10)</a>:</h4>
<p>for metadata loading</p>



<a name="176120369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176120369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176120369">(Sep 19 2019 at 17:11)</a>:</h4>
<blockquote>
<p>is that your WIP PR? I can take a look</p>
</blockquote>
<p>yes</p>



<a name="176120540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176120540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176120540">(Sep 19 2019 at 17:13)</a>:</h4>
<blockquote>
<p>hm, no I think that's more likely that it needs to be added to cstore</p>
</blockquote>
<p>"installed" here <a href="https://github.com/rust-lang/rust/pull/64599/files#diff-f682599ab8df719f4fa313038a5d2f72R136" target="_blank" title="https://github.com/rust-lang/rust/pull/64599/files#diff-f682599ab8df719f4fa313038a5d2f72R136">https://github.com/rust-lang/rust/pull/64599/files#diff-f682599ab8df719f4fa313038a5d2f72R136</a></p>



<a name="176120703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176120703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176120703">(Sep 19 2019 at 17:15)</a>:</h4>
<p>more precisely, it failed when doc'ing alloc crate <br>
<a href="/user_uploads/4715/n7bDMlWKov526trOca9vRhHS/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/n7bDMlWKov526trOca9vRhHS/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/n7bDMlWKov526trOca9vRhHS/pasted_image.png"></a></div>



<a name="176121102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176121102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176121102">(Sep 19 2019 at 17:19)</a>:</h4>
<p>ah, yes, so you'll also need to install it for the "local" crate</p>



<a name="176121335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176121335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176121335">(Sep 19 2019 at 17:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116773">@csmoe</span> I'm not sure if there's a good place to do it -- you can probably add it to ty/mod.rs and put the provider in here: <a href="https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357">https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357</a></p>



<a name="176121594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176121594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176121594">(Sep 19 2019 at 17:24)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116773">csmoe</span> I'm not sure if there's a good place to do it -- you can probably add it to ty/mod.rs and put the provider in here: <a href="https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357">https://github.com/rust-lang/rust/blob/master/src/librustc/ty/mod.rs#L3352-L3357</a></p>
</blockquote>
<p>thanks <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span></p>



<a name="176121726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176121726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176121726">(Sep 19 2019 at 17:25)</a>:</h4>
<p>Ah, I see Niko said much the same :)</p>



<a name="176121731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176121731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176121731">(Sep 19 2019 at 17:26)</a>:</h4>
<p>yep I left <span class="user-mention" data-user-id="116773">@csmoe</span> some notes on the PR, too, but I hadn't gotten around to looking for a good place though</p>



<a name="176121775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176121775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176121775">(Sep 19 2019 at 17:26)</a>:</h4>
<p>I think <span class="user-mention" data-user-id="116122">@simulacrum</span>'s suggestion sounds fine</p>



<a name="176201067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176201067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176201067">(Sep 20 2019 at 15:07)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <a href="https://github.com/rust-lang/rust/pull/64599" target="_blank" title="https://github.com/rust-lang/rust/pull/64599">PR</a> is ready for your review  <br>
<a href="/user_uploads/4715/46M5Z7-x4iYlUJACSRiiz55L/pasted_image.png" target="_blank" title="pasted_image.png">pasted image</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/46M5Z7-x4iYlUJACSRiiz55L/pasted_image.png" target="_blank" title="pasted image"><img src="/user_uploads/4715/46M5Z7-x4iYlUJACSRiiz55L/pasted_image.png"></a></div>



<a name="176202052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176202052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176202052">(Sep 20 2019 at 15:19)</a>:</h4>
<p>and I found another case(not related to this bug)<br>
<a href="https://docs.rs/tokio-sync/0.2.0-alpha.2/tokio_sync/mpsc/struct.Receiver.html#method.recv" target="_blank" title="https://docs.rs/tokio-sync/0.2.0-alpha.2/tokio_sync/mpsc/struct.Receiver.html#method.recv">https://docs.rs/tokio-sync/0.2.0-alpha.2/tokio_sync/mpsc/struct.Receiver.html#method.recv</a><br>
rustdoc inserted a <code>`_</code> lifetime into the fn_sig, but elided in the <a href="https://docs.rs/tokio-sync/0.2.0-alpha.2/src/tokio_sync/mpsc/bounded.rs.html#170-174" target="_blank" title="https://docs.rs/tokio-sync/0.2.0-alpha.2/src/tokio_sync/mpsc/bounded.rs.html#170-174">source code</a>, is this intended?</p>



<a name="176207731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176207731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> csmoe <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176207731">(Sep 20 2019 at 16:26)</a>:</h4>
<div class="codehilite"><pre><span></span>struct A;
impl A {
    async fn foo(&amp;self) {}
}
</pre></div>


<p><code>rustc +nightly --edtion 2018 --Z unpretty=hir</code> prints:</p>
<div class="codehilite"><pre><span></span>struct A;
impl A {
    async fn foo&lt;&#39;_&gt;(self: &amp;&#39;_ Self)
     -&gt;  ::std::future::from_generator(move || { let self = self; })
}
</pre></div>


<p>hir seems the one to blame for such <code>`_</code> insertion, and it <a href="https://github.com/rust-lang/rust/issues/64630" target="_blank" title="https://github.com/rust-lang/rust/issues/64630">breaks</a> the anonymous lifetime(impl Foo&lt;`_&gt; { ... })</p>



<a name="176212980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176212980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176212980">(Sep 20 2019 at 17:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116773">@csmoe</span> kind of looks like a bug, yeah</p>



<a name="176212999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176212999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176212999">(Sep 20 2019 at 17:23)</a>:</h4>
<p>though I think it's more a <em>rustdoc</em> bug</p>



<a name="176213078"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176213078" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176213078">(Sep 20 2019 at 17:24)</a>:</h4>
<p>that is, the HIR has to insert those lifetimes, but they have a special designator ("fresh" or something?) that indicates they were added automatically, we are probably ignoring that distinction in rustdoc</p>



<a name="176213081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176213081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176213081">(Sep 20 2019 at 17:24)</a>:</h4>
<p>also, nice job!</p>



<a name="176213356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176213356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176213356">(Sep 20 2019 at 17:26)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="133692">@QuietMisdreavus</span> -- are there any docs for how to add new rustdoc tests?</p>



<a name="176215133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176215133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> QuietMisdreavus <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176215133">(Sep 20 2019 at 17:45)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> not in the rustc guide, but the syntax for the rustdoc tests is best explained in the top comment in <code>src/etc/htmldocck.py</code></p>



<a name="176215196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/rustdoc%20and%20async%20fn%20%2363710/near/176215196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> QuietMisdreavus <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/rustdoc.20and.20async.20fn.20.2363710.html#176215196">(Sep 20 2019 at 17:46)</a>:</h4>
<p>i think i’ve seen that issue before</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>